package com.vitabuybuy.tv.dto;

/**
 * 作者：SimGa
 * 日期：2021/1/9
 * 时间：16:49
 * 包名：com.vitabuybuy.tv.dto
 */
public class MyCouponDto {

    /**
     * useEndTime : 2021-01-30
     * useStartTime : 2020-12-23
     * name : 测试优惠券
     * discount : 50
     * id : 9
     * precondition : 0
     */

    private CouponBean coupon;
    /**
     * coupon : {"useEndTime":"2021-01-30","useStartTime":"2020-12-23","name":"测试优惠券","discount":50,"id":9,"precondition":0}
     * createTime : 2020-12-24 10:41:20
     * available : true
     * id : 1
     * status : 未使用
     */

    private String createTime;
    private boolean available;
    private int id;
    private String status;

    public CouponBean getCoupon() {
        return coupon;
    }

    public void setCoupon(CouponBean coupon) {
        this.coupon = coupon;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public boolean isAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public static class CouponBean {
        private String useEndTime;
        private String useStartTime;
        private String name;
        private String type;
        private double discount;
        private int id;
        private int precondition;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getUseEndTime() {
            return useEndTime;
        }

        public void setUseEndTime(String useEndTime) {
            this.useEndTime = useEndTime;
        }

        public String getUseStartTime() {
            return useStartTime;
        }

        public void setUseStartTime(String useStartTime) {
            this.useStartTime = useStartTime;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public double getDiscount() {
            if (type.equals("折扣")) {
                return discount / 10;
            }
            return discount;
        }

        public void setDiscount(double discount) {
            this.discount = discount;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public int getPrecondition() {
            return precondition;
        }

        public void setPrecondition(int precondition) {
            this.precondition = precondition;
        }
    }
}
